let arr = [1, 6, 4, 8, 3, 5, 1, 11];
// 选出一个目标比他小的放左面，大的放右面

const quickSort = (arr) => {
    if (arr == null || arr.length == 0) return [];
    let leader = arr[0];
    let left = [];
    let right = [];
    for (let i = 1; i < arr.length; i++) {
        if (arr[i] > leader) {
            right.push(arr[i]);
        } else {
            left.push(arr[i]);
        }
    }
    left = quickSort(left);
    right = quickSort(right);
    left.push(leader);
    return [...left, ...right]
}
console.log(quickSort(arr));